//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _PTTIMEMARKVIEW_H
#define _PTTIMEMARKVIEW_H
//
#include <QObject>
#include <model/particletemplate.h>
#include "view.h"
//
class QLineEdit;
class QComboBox;
class RandomDoubleWidget;
class PTTimeMarkView:public QObject,public View
{
   Q_OBJECT
   Q_DISABLE_COPY(PTTimeMarkView)
//construction
public:
   PTTimeMarkView(QObject *p_parent=0);
   ~PTTimeMarkView();
//signals
signals:
//slots
protected slots:
   void on_name_edit_editingFinished();
   void on_other_combo_currentIndexChanged(int p_i);
   void on_time_widget_value_changed();
//View
protected:
   void handle_set_attr_group();
   void handle_attr_event(AttrEvent *p_ae);
   void handle_post_primitive(const Primitive &p_prim);
//access
public:
   QWidget *get_name_widget() const;
   QWidget *get_other_widget() const;
   QWidget *get_time_widget() const;
//implementation
private:
   model::ParticleTemplate *particle_template;
   QString tm_name;
   QLineEdit *name_edit;
   QComboBox *other_combo;
   RandomDoubleWidget *time_widget;
   void update_widgets();
   void repopulate_other_combo();
   void set_other_combo(const model::ParticleTemplate::TimeMark &p_tm);
   void read_other_combo(int p_index,model::ParticleTemplate::TimeMark &p_tm);
   model::ParticleTemplate::TimeMark &get_tm();
};
//
#endif
